package com.example.demo.handler;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.example.demo.dto.ComboDto;
import com.example.demo.service.ComboService;
import com.woniuxy.movice.entity.Combo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api("总影院管理")
@RestController
@RequestMapping(value="/combo")
@lombok.Data
public class ComboController {
	@Resource
	private ComboService comboService;
	
	@ApiOperation(value="获得所有套餐信息",notes="返回所有套餐")
    @RequestMapping(value="/getAllCombo",method=RequestMethod.GET)
    public List<Combo> getAllCombo(){
        return comboService.getAllCombo();
    }
	
	@ApiOperation(value="获得所有套餐数量",notes="返回所有套餐购买数量")
    @RequestMapping(value="/getComboCount",method=RequestMethod.GET)
    public List<ComboDto> getComboCount(){
        return comboService.getComboCount();
    }
	
	@ApiOperation(value="删除某套餐",notes="返回是否成功,输入(int) tid")
    @RequestMapping(value="/delCombo",method=RequestMethod.POST)
    public String deleteCombo(int tid){
        return comboService.deleteCombo(tid);
    }
	
	@ApiOperation(value="新增套餐",notes="返回是否成功,输入(int) tprice，(String) ttype")
    @RequestMapping(value="/addCombo",method=RequestMethod.POST)
    public String addCombo(int tprice,String ttype, int tyear){
        return comboService.addCombo(tprice, ttype, tyear);
    }
	
	@ApiOperation(value="修改套餐",notes="返回是否成功，输入(int) tprice，(int) tid")
    @RequestMapping(value="/updateCombo",method=RequestMethod.POST)
    public String updateCombo(int tprice,int tid){
        return comboService.updateCombo(tprice, tid);
    }
}
